package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 综合服务展会
 * </p>
 *
 * @author linan
 * @date 2023-04-04
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionManageExhibitionTypeEnum", description = "展会类型 #{SELF_EXHIBITION:自办展;GUEST_EXHIBITION:客展}-枚举")
public enum ExhibitionManageExhibitionTypeEnum implements BaseEnum {

    /**
     * SELF_EXHIBITION="自办展"
     */
    SELF_EXHIBITION("自办展"),
    /**
     * GUEST_EXHIBITION="客展"
     */
    GUEST_EXHIBITION("客展"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionManageExhibitionTypeEnum match(String val, ExhibitionManageExhibitionTypeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionManageExhibitionTypeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionManageExhibitionTypeEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "SELF_EXHIBITION,GUEST_EXHIBITION", example = "SELF_EXHIBITION")
    public String getCode() {
        return this.name();
    }

}
